/*
 * Filename    : Text_Manager.java
 * Projectname : RamaShinta
 * Date        : Nov 18, 2012 , 8:44:47 PM 
 * 
 * Class for attaching Text on our Games
 * 
 * Subclass Tex_Load
 */

package com.amikomgamedev.ramashinta.text;

import org.andengine.engine.camera.hud.HUD;
import org.andengine.entity.modifier.ScaleAtModifier;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.text.Text;

import android.R.string;
import android.content.Context;

import com.amikomgamedev.ramashinta.ServerData;
import com.amikomgamedev.ramashinta.Utils;
import com.amikomgamedev.ramashinta.graphic.Graphic_Detach;

public class Text_Manager extends Text_Load
{

	public Text	txt_credit;
	public Text	credit;
	public Text	you_win;
	public Text	you_Lose;
	public Text	Beta_Version;
	public Text[] Level = new Text[10];

	public Text_Manager(Context context, Scene scene, HUD hud, Graphic_Detach grafik)
	{
		super(context, scene, hud, grafik);
		// TODO Auto-generated constructor stub
	}

	public void attachStart()
	{
		if (txt_credit == null)
			txt_credit = new Text(0, 0, font_Medium, "Credits", getVertexBufferManager());
		m_Scene.attachChild(txt_credit);
		txt_credit.setPosition(Utils.getRatio(600), Utils.getRatio(300));
		m_Scene.registerTouchArea(txt_credit);
	}

	public void attachCredit()
	{
		if (credit == null)
			credit = new Text(0, 0, font_Big, "www.cupcorngames.com", getVertexBufferManager());
		

	}

	public void attachYouWin()
	{
		if (you_win == null)
		{
			you_win = new Text(0, 0, font_Big, "You Win", getVertexBufferManager());
		}

		m_Scene.attachChild(you_win);

		you_win.setPosition(RES_WIDTH / 2 - you_win.getWidth() / 2, Utils.getRatio(75));
		you_win.registerEntityModifier(new ScaleAtModifier(2, 1, 3,you_win.getWidth()/2,you_win.getHeight()/2));

	}
	
	public void attachBetaVersion()
	{
		if (Beta_Version == null)
		{
			Beta_Version = new Text(0, 0, font_Big, "Beta Version", getVertexBufferManager());
		}

	}
	
	public void detachBetaVersion() {
		Beta_Version.detachSelf();
	}
	
	public void detachYouWin(){
		you_win.detachSelf();
	}
	
	public void detachYouLose(){
		you_Lose.detachSelf();
	}
	
	public void detachLevel(){
		for(int i=0; i<Level.length;i++){
			Level[i].detachSelf();
		}
	}
	
	public void attachYouLose()
	{
		if (you_Lose == null)
		{
			you_Lose = new Text(0, 0, font_Big, "You Lose", getVertexBufferManager());
		}

		m_Scene.attachChild(you_Lose);

		you_Lose.setPosition(RES_WIDTH / 2 - you_Lose.getWidth() / 2, Utils.getRatio(75));
		you_Lose.registerEntityModifier(new ScaleAtModifier(2, 1, 3,you_Lose.getWidth()/2,you_Lose.getHeight()/2));

	}
	
	public void createTextLevel()
	{
		
			for(int i=0;i<Level.length;i++){
				Level[i] = new Text(0, 0, font_Big_Candy, "Level " + String.valueOf(i+1), getVertexBufferManager());
			}
		
	}

	public void detachTextMenu()
	{
		txt_credit.detachSelf();

	}

	public void detachTextCredit()
	{
		credit.detachSelf();
	}

}
